<template>
	<view class="event_details">
		<view class="end-title">
		　　<view @tap="changeTab(0)" :class="{btna:btnnum == 0}">案件详情</view>
		  　<view @tap="changeTab(1)" :class="{btna:btnnum == 1}">处置记录</view>
		</view>
		<view class="event_box">
			<view class="end-cont" :class="{dis:btnnum == 0}">
			 　	<view class="type_status">
					<view class="event_type">{{eventItem.eventTypeLv2Name}}</view>
					<view class="event_status">{{eventItem.eventDealStatusName}}</view>
				</view>
				<view class="describe">案件描述：{{eventItem.eventDescribe}}</view>
				<view class="map_image">
					<view class="map_box">
						<!-- <view class="screen_big">
							<cover-image @click="lookBIgMap" class="coverImag" src="../../static/city-manage/screen_big.png"></cover-image>
						</view> -->
						<!-- #ifdef H5 -->
						<!-- <view id="MyMap"></view> -->
						<map class="H5_map" :latitude="latitude" :longitude="longitude" :markers="covers" scale="16">
							<cover-image @click="lookBIgMap" class="coverImag" src="../../static/city-manage/screen_big.png"></cover-image>
						</map>
						<!-- #endif -->
						<!-- #ifdef APP-PLUS -->
						<map class="H5_map" :latitude="latitude" :longitude="longitude" :markers="covers" scale="16">
							<cover-image @click="lookBIgMap" class="coverImag" src="../../static/city-manage/screen_big.png"></cover-image>
						</map>
						<!-- #endif -->
					</view>
					<view class="image_box">
						<image :src="image_url + img_item.path" v-if="smallImgData && smallImgData.length>0" v-for="(img_item, img_index) in smallImgData" :key="img_index" @click="seeImages(img_index, bigImgData, 'details')" mode="aspectFit"></image>
					</view>
				</view>
				<view class="event_msg">
					<view class="msg_item1">处置状态：
					<view class="msg_item1_img">
						<view class="msg_item1_img1" @click="openImage(1)">
							<image src="../../static/city-manage/p_yingji.png" mode="aspectFit" style="width: 80%; height: 80%;"></image>
						</view>
						<view class="msg_item1_img1" @click="openImage(2)">
							<image src="../../static/city-manage/p_yinhuan.png" mode="aspectFit" style="width: 70%; height: 70%;"></image>
						</view>
						<view class="msg_item1_img1" @click="openImage(3)">
							<image src="../../static/city-manage/p_yanqi.png" mode="aspectFit" style="width: 90%; height: 90%;"></image>
						</view>
						<view class="msg_item1_img1" @click="openImage(4)">
							<image src="../../static/city-manage/p_huanban.png" mode="aspectFit" style="width: 70%; height: 70%;"></image>
						</view>
					</view>
					</view>
					<view class="msg_item">案件类别：{{eventItem.eventTypeName}}</view>
					<view class="msg_item">案件大类：{{eventItem.eventTypeLv1Name}}</view>
					<view class="msg_item">案件小类：{{eventItem.eventTypeLv2Name}}</view>
					<view class="msg_item">立案条件：{{eventItem.archivesTypeLeveThree.starConditions}}</view>
					<view class="msg_item">所属部门：{{eventItem.deptName}}</view>
					<view class="msg_item">部门行业：{{eventItem.industryTypeLv1Name}}</view>
					<view class="msg_item">行业类别：{{eventItem.industryTypeLv2Name}}</view>
					<view class="msg_item">养护单位：{{eventItem.industryTypeLv2Name}}</view>
					<view class="msg_item">案件编号：{{eventItem.eventName}}</view>
					<view class="msg_item">处理时限：{{times}} {{timesTypeName}} {{timesUnitName}}</view>
				</view>

			</view>
			<view class="end-cont end_cont_two" :class="{dis:btnnum == 1}">
			 　　<view class="type_status">
					<view class="event_type">{{eventItem.eventTypeLv2Name}}</view>
					<view class="event_status">{{eventItem.eventDealStatusName}}</view>
				</view>
				<view class="event_logs">
					<view class="logs_item" v-for="(item,index) in eventLogListData" :key="index">
						<view class="circle"></view>
						<view class="logs_box">
							<view class="logs_status">{{item.typeName}}</view>
							<view class="task_date">{{item.createTime}}</view>
							<view class="logs_msg">{{item.describe}}</view>
							<view class="logs_msg">{{item.remark}}</view>
							<view class="logs_image" v-if="item.small_images.length>0">
								<image :src="image_url + item_img.path" mode="aspectFit" v-for="(item_img, item_index) in item.small_images" :key="item_index" @click="seeImages(item_index, item.big_images, 'logs')"></image>

							</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 7.7 标段机构接线员角色  自定义type=11 显示按钮
			待受理状态显示  受理和回退按钮 0201
			带派遣状态显示  派遣和缓办   0202
			0200待处置 -->
			<view class="pending_buttons" v-if="userInfo.role.roleKey === 'bdjgjxy'&& type ==11">
				<view class="btnState" v-if="eventItem.eventDealStatus == '0201'">
					<button @click="acceptance(1)" type="default" >受理</button>
					<button @click="acceptance(2)" type="default">回退</button>
				</view>
				<view class="btnState" v-if="eventItem.eventDealStatus == '0202'">
					<button @click="acceptance(3)" type="default" >派遣</button>
					<button @click="acceptance(2)" type="default" >回退</button>
					<button @click="acceptance(4)" type="default"  v-if="eventItem.archivesTypeLeveThree.isHb == '是'">缓办</button>
				</view>
				<view class="btnState" v-if="eventItem.eventDealStatus == '0203'">
					<button @click="acceptance(5)" type="default" >督办</button>
					<button @click="acceptance(6)" type="default" v-if="eventItem.archivesTypeLeveThree.isYq == '是'">延期</button>
				</view>
				<view class="btnState" v-if="eventItem.eventDealStatus == '0204'">
					<button @click="acceptance(3)" type="default">重新派遣</button>
					<button @click="acceptance(7)" type="default">审核</button>
				</view>
			</view>

			<!-- 机构处置人员-----处置按钮 -->
			<view class="pending_buttons" v-if="(userInfo.role.roleKey === 'jgczry' || userInfo.role.roleKey === 'czry') && type != 3 && eventItem.eventDealStatus == '0203'">
				<button @click="managementCase(1)" type="default">案件处置</button>
				<button @click="managementCase(3)" type="default">案件会话</button>
				<button @click="managementCase(2)" type="default">案件回退</button>
			</view>

			<!-- 超级管理员----案件评价 -->
			<!--0207 结案-->
			<view class="pending_buttons" v-if="userInfo.role.roleKey == 'admin' && (eventItem.eventDealStatus != '0207' && eventItem.eventDealStatus !='0002' && eventItem.eventDealStatus !='0001')">
				<button type="default" @click="managementCase(4)">案件督办</button>
			</view>
			<view class="pending_buttons" v-if="userInfo.role.roleKey == 'admin' && (eventItem.eventDealStatus == '0207' || eventItem.eventDealStatus == '0002') && eventItem.eventEvaluate.isEvaluate == '0'">
				<button type="default"  @click="managementCase(5)">案件评价</button>
			</view>
		</view>

		<!-- 案件受理 弹出层 -->
		<uni-popup ref="popupaceance" type="center">
			<uni-popup-dialog title='提示' content="确定受理" :duration="2000" :before-close="true" @close="closepup" @confirm="confirm">
			</uni-popup-dialog>
		</uni-popup>
		<!-- 案件 回退 窗口  -->
		<uni-popup ref="popupaback"  type="center">
			<view class="uni-tip">
				<!-- 标题 -->
				<view class="uni-tip-title">回退原因：</view>
				<view class="uni-tip-content">
					<!-- 中间内容进行自定义 -->
					 <textarea class="uni-tip-content-textarea" focus="true" placeholder="请输入回退原因" maxlength="-1" v-model="contenttext" />
				</view>
				<!-- 按钮部分 -->
				<!-- <view class="uni-tip-group-button">
					<button type="warn" @click="cancel">取消</button>
					<button type="primary" @click="query">确定</button>
				</view> -->
				<view class="uni-tip-group-button">
					<button type="default" @click="cancel(1)">取消</button>
					<button type="default" @click="query()">确定</button>
				</view>
			</view>
		</uni-popup>
		<!-- 案件督办弹出框 -->
		<uni-popup ref="supervises">
			<view class="uni-tip">
				<!-- 标题 -->
				<view class="uni-tip-title">督办意见：</view>
				<view class="uni-tip-content">
					<!-- 中间内容进行自定义 -->
					 <textarea class="uni-tip-content-textarea" focus="true" placeholder="请输入督办意见" maxlength="-1" v-model="supervisesText" />
				</view>
				<view class="uni-tip-group-button">
					<button type="default" @click="cancel(3)">取消</button>
					<button type="default" @click="superviseBtn()">确定</button>
				</view>
			</view>
		</uni-popup>
		<!-- 案件 延期弹出框 -->
		<uni-popup ref="deferment">
				<view class="uni-tip">
					<!-- 标题 -->
					<view class="uni-tip-title">延期原因：</view>
					<view class="uni-tip-content">
						<!-- 中间内容进行自定义 -->
						 <textarea class="uni-tip-content-textarea" focus="true" placeholder="请输入延期原因" maxlength="-1" v-model="defermentText" />
					</view>
					<view class="uni-tip-group-button">
						<button type="default" @click="cancel(4)">取消</button>
						<button type="default" @click="defermentBtn()">确定</button>
					</view>
				</view>
			</uni-popup>
		<!-- 案件派遣人员窗口  -->
		<!-- 案件派遣弹出框 -->
		<uni-popup ref="popupapersenList">
			<view class="uni-tip">
				<!-- 标题 -->
				<view class="uni-tip-title">请选择派遣人员：</view>
				<view class="uni-contant" v-if="persenList.length>0">
					<view  @tap="change(index)" :class="{btna1:btnnum1 == index}" v-for="(item, index) in persenList" :key="index">
						{{item.nickName}}   {{item.phonenumber}}
					</view>
				</view>
				<view class="uni-contant" v-else>暂无派遣人员
				</view>
				<view class="uni-tip-group-button">
					<button type="default" @click="cancel(2)">取消</button>
					<button type="default" @click="personset()">确定</button>
				</view>
			</view>
		</uni-popup>
		<!-- 案件评价弹出层 -->
		<uni-popup ref="popupPingjia" type="center" background-color="#fff">
			<view class="popup-content-pingjia">
				<view class="pingjia_content">
					<view class="content_item" v-if="current_handing_type == 5">
						<view class="item_label">案件评价：</view>
						<select v-model="evaluateStatus">
							<option value='' disabled selected style='display:none;'>请选择</option>
							<option value="1">不合格</option>
							<option value="0">合格</option>
						</select>
					</view>
					<view class="content_item">
						<view class="item_label">{{mtitle}}：</view>
						<textarea type="text" v-model="evaluateRemark" :placeholder="'请输入'+ mtitle"/>
					</view>
				</view>
				<view class="pending_buttons">
					<button type="default" @click="closePopupPingjia">取消</button>
					<button type="default" @click="confirmPingjia">确定</button>
				</view>
			</view>
		</uni-popup>

		<!-- 地图弹出层 -->
		<uni-popup ref="popupMap" type="center" background-color="#fff">
			<view class="popup-content">
				<image @click="closeToggleMap" class="close_map" src="../../static/city-manage/close_map.png"></image>
				<public-map ref="publicMapDialog" :gdx="gdx" :gdy="gdy" ></public-map>
			</view>
		</uni-popup>
		<new-map ref="publicMapDialog" :gdx="gdx" :gdy="gdy" v-if="isShow" @hideMap="hideMap"></new-map>
	</view>
</template>

<script>
	import {getEventInfoByEventId, getEventLogList,getcaseHandingaccept,
	getcaseHandingupdateDel,getcaseHandingsendperson,getcaseHandingsend,getcaseHandingsupervise,
	getcaseHandingdeferment,getcasecheckDelay,getisCheckHb,getisCheckSHcase,getisCheckBack} from '@/api/my_task'
	import {updateEventEvaluate} from '@/api/pending_cases.js'
	import publicMap from '@/pages/mycomponents/publicMap.nvue'
	import newMap from '@/pages/mycomponents/newMap1.vue'
	import URL from '../../util/url.js'
	export default {
		components:{
			'public-map': publicMap,
			'new-map':newMap
		},
		data () {
			return {
				isShow:false,
				contenttext:'',
				supervisesText:'',
				defermentText:'',
				image_url: URL.CASEIMAGE_URL,
				//派遣人员 列表
				persenList:[],
				//用户登录信息
				userInfo: uni.getStorageSync('userInfo'),
				eventItem: {
					archivesTypeLeveThree:{}
				},
				btnnum: 0,
				btnnum1:0,
				GDMap: null,
				marker: null,
				gdx:'',
				gdy:'',
				//H5
				longitude:'108.99569',
				latitude:'34.20124',
				covers:[],
				//判断是从哪个页面进入到详情的
				type:'',
				//处置记录数据
				eventLogListData: [],
				//案件评价
				evaluateRemark:'',
				evaluateStatus: '',
				mtitle:'',
				current_handing_type:null,
				small_images:[],
				big_images:[],
				smallImgData:[],
				bigImgData:[],
				case_id: null,
				sendTargetId:'',//派遣人id
				times:'',
				timesTypeName:'',
				timesUnitName:'',
			}
		},
		onLoad: function (option) {
			//获取传过来的数据
			this.eventItem = option.eventItem? JSON.parse(option.eventItem): {archivesTypeLeveThree:{}};
			this.case_id = option.case_id;

			this.type = option.type;
			// #ifdef H5
			//初始化地图
			this.$nextTick(() => {
				//this.initMap();
			});
			// #endif
			//获取案件详情
			this.getEventInfoByEventId();
			//案件处置日志
			this.getEventLogList();
			//调用案件受理接口
			uni.$on('pending', () => {
				this.confirm();

			})
			//调用回退接口
			uni.$on('goback', (res) => {
				this.contenttext = res.title;
				this.query();
			})
			//调用督办接口
			uni.$on('duban', (res) => {
				this.supervisesText = res.title;
				this.superviseBtn();
			})
			//调用延期接口
			uni.$on('yanqi', (res) => {
				this.defermentText = res.title;
				this.defermentBtn();
			})
			//调用派遣接口
			uni.$on('paiqian', (res) => {
				this.sendTargetId =res.title
				this.personset();
			})
			//调用派遣接口
			uni.$on('shenhe', (res) => {
				this.getCaseSh(res.title)
			})
			//调用派遣接口
			uni.$on('bohui', (res) => {
				this.getCaseBh(res.title)
			})
		},
		onUnload() {
		// 移除监听事件
			uni.$off('pending');
			uni.$off('goback');
			uni.$off('duban');
			uni.$off('yanqi');
			uni.$off('paiqian');
			uni.$off('shenhe');
			uni.$off('bohui');
			// uni.$off('newPublicMap')
		},
		methods: {
			hideMap(res){
				this.isShow = false;
			},
			//小图标 点击
			openImage(num){
				var  message;
				switch (num) {
			      case 1:
			        message = '案件应急';
			        break;
			      case 2:
			        message = '案件隐患';
			        break;
			      case 3:
			        message = '案件延期';
			        break;
			      case 4:
			        message = '案件缓办';
			        break;
			    }
				this.$tip.toast(message);
			},
			//案件 受理取消
			closepup() {
				this.$refs.popupaceance.close()
			},
			//案件受理确定
			confirm(value) {
				uni.showLoading()
				var parmes = {
					eventId: this.eventItem.eventId?this.eventItem.eventId: this.case_id,
					id: this.eventItem.eventThree.id
				}
				getcaseHandingaccept(parmes).then((res)=>{
					uni.hideLoading();
					if(res.code == '200'){
						this.$tip.toast(res.msg)
						// this.$refs.popupaceance.close()
						this.getEventInfoByEventId();
						this.getEventLogList();
						uni.$emit("handleFun",{title: 'shenhe'});
					}else{
						this.$tip.toast(res.msg)
					}

				}).catch((error) => {
					this.$tip.toast(error.msg)
					uni.hideLoading();
				})
			},
			//案件受理 1 回退2  派遣3   4缓办 督办5  延期6  7审核 8 驳回
			acceptance(type){
				if(type == 1){
					// this.$refs.popupaceance.open('top')
					const subNVuePend = uni.getSubNVueById('pending')
					subNVuePend.show('fade-in', 300, function() {})
				}else if(type == 2){
					// this.$refs.popupaback.open('top')
					const subNVueback = uni.getSubNVueById('goback')
					subNVueback.show('fade-in', 300, function() {})
				}else if(type == 3){
					this.getpersonList();
					// this.$refs.popupapersenList.open('top')
					const subNVuepaiqian = uni.getSubNVueById('paiqian')
					subNVuepaiqian.show('fade-in', 300, function() {})
				}else if(type == 4){
					// 先判断是否可以 缓办跳转 缓办页面
					this.ischeckHb()
				}else if(type == 5){
					// this.$refs.supervises.open('top')
					const subNVueduban = uni.getSubNVueById('duban')
					subNVueduban.show('fade-in', 300, function() {})
				}else if(type == 6){
					//先判断是否可以延期
					this.isdefermentType();
				}else if(type == 7){
					//审核
					const subNVueshenhe = uni.getSubNVueById('shenhe')
					subNVueshenhe.show('fade-in', 300, function() {})
				}else if(type == 8){
					//驳回
					const subNVuebohui = uni.getSubNVueById('bohui')
					subNVuebohui.show('fade-in', 300, function() {})
				}
			},
			//判断是否 可以缓办
			ischeckHb(){
				uni.showLoading()
				let parmes = {eventId:this.eventItem.eventId?this.eventItem.eventId: this.case_id}
				getisCheckHb(parmes).then((res)=>{
					uni.hideLoading();
					if(res.data.isDelay == 1||res.data.isTs == 1||res.data.wsCount > 0||res.data.tgCount >= 10){
						if(res.data.isDelay == 1){
							this.$tip.toast('案件超时暂不能缓办')
						}
						if(res.data.isTs == 1){
							this.$tip.toast('特殊案件暂不能缓办')
						}
						if(res.data.wsCount > 0){
							this.$tip.toast('有已申请的未处理的案件暂不能缓办')
						}
						if(res.data.tgCount >= 10){
							this.$tip.toast('超过10次暂不能缓办')
						}
					}else{
						// 可以缓办跳转缓办页面/  缓办页面 是单独写的一个页面 预防与之前混淆老代码
						uni.navigateTo({
							url: '/pages/casehandling/ponementcase?gdx='+this.eventItem.gdx+'&gdy='+this.eventItem.gdy+'&eventId='+ (this.eventItem.eventId? this.eventItem.eventId: this.case_id) + '&current_handing_type=11'
						})
					}
				}).catch((err)=>{
					uni.hideLoading();
				})
			},
			//判断是否可以延期
			//超过10次的不能延期 有已申请的未处理的不能延期  是特殊来源不能延期 超时不能延期
			isdefermentType(){
				uni.showLoading()
				let parmes = {eventId:this.eventItem.eventId?this.eventItem.eventId: this.case_id}
				getcasecheckDelay(parmes).then((res)=>{
					uni.hideLoading();
					if(res.code == '200'){
						if(res.data.isDelay == 1||res.data.isTs == 1||res.data.wsCount > 0||res.data.tgCount >= 10){
							if(res.data.isDelay == 1){
								this.$tip.toast('案件超时暂不能延期')
							}
							if(res.data.isTs == 1){
								this.$tip.toast('特殊案件暂不能延期')
							}
							if(res.data.wsCount > 0){
								this.$tip.toast('有已申请的未处理的案件暂不能延期')
							}
							if(res.data.tgCount >= 10){
								this.$tip.toast('超过10次暂不能延期')
							}
						}else{
							// this.$refs.deferment.open('top')
							const subNVueyanqi = uni.getSubNVueById('yanqi')
							subNVueyanqi.show('fade-in', 300, function() {
							})
						}
					}else{
						this.$tip.toast(res.msg)
					}
				}).catch((err)=>{
					uni.hideLoading();
				})
			},
			//确认督办
			superviseBtn(){
				uni.showLoading()
				let parmes = {
					eventId:this.eventItem.eventId?this.eventItem.eventId: this.case_id,  //案卷id
					contents: this.supervisesText
				}
				getcaseHandingsupervise(parmes).then((res)=>{
					uni.hideLoading();
					if(res.code == '200'){
						this.$tip.toast(res.msg)
						// this.cancel(3);
					}else{
						this.$tip.toast(res.msg)
					}
				}).catch((error) => {
					this.$tip.toast(error.msg)
					uni.hideLoading();
				})
			},
			//确认延期
			defermentBtn(){
				uni.showLoading()
				let parmes = {
					eventId:this.eventItem.eventId?this.eventItem.eventId: this.case_id,  //案卷id
					reason: this.defermentText
				}
				getcaseHandingdeferment(parmes).then((res)=>{
					uni.hideLoading();
					if(res.code == '200'){
						this.$tip.toast(res.msg)
						// this.cancel(4);
					}else{
						this.$tip.toast(res.msg)
					}
				}).catch((error) => {
					this.$tip.toast(error.msg)
					uni.hideLoading();
				})
			},

			  /** 1回退弹窗取消方法 */  //2派遣按钮取消方法  3督办窗口的取消方法
			cancel(e) {
				if(e == 1){
					this.contenttext = '';
					this.$refs.popupaback.close()
				}else if(e == 2){
					this.$refs.popupapersenList.close()
				}else if(e == 3){
					this.supervisesText = ''
					this.$refs.supervises.close()
				}else if(e == 4){
					this.defermentText = ''
					this.$refs.deferment.close()
				}

			},
			/** 回退弹窗确定方法 */
			query() {
				uni.showLoading()
				let parmes = {
					eventId:this.eventItem.eventId?this.eventItem.eventId: this.case_id,  //案卷id
					id:this.eventItem.eventThree.id,  //分流表id
					params:{
						eventDescribe:this.contenttext
					}
				}
				getcaseHandingupdateDel(parmes).then((res)=>{
					uni.hideLoading();
					if(res.code == '200'){
						this.$tip.toast(res.msg)
						// this.cancel(1);
						setTimeout(()=> {
							uni.navigateBack({
								delta: 1 // 返回上一级页面。
							})
							uni.$emit("handleFun",{title: 'huitui'});
						},1000)
					}else{
						this.$tip.toast(res.msg)
					}
				}).catch((error) => {
					this.$tip.toast(error.msg)
					uni.hideLoading();
				})
			},

			//确定派遣接口
			personset(){
				let parmes = {
					eventId: this.eventItem.eventId?this.eventItem.eventId: this.case_id,
					// sendTargetId: this.persenList[this.btnnum1].userId,
					sendTargetId: this.sendTargetId
				}
				uni.showLoading()
				getcaseHandingsend(parmes).then((res)=>{
					uni.hideLoading();
					if(res.code == '200'){
						this.$tip.toast(res.msg)
						uni.$emit("handleFun",{title: 'paiqian'});
						setTimeout(()=> {
							uni.navigateBack({
								delta: 1 // 返回上一级页面。
							})
						},1000)
					}else{
						this.$tip.toast(res.msg)
					}
				}).catch((error) => {
					this.$tip.toast(error.msg)
					uni.hideLoading();
				})
			},
			change(e){
				this.btnnum1 = e
			},
			// 获取派遣人员 列表
			getpersonList(){
				let parse = {
					eventId:this.eventItem.eventId?this.eventItem.eventId: this.case_id,
					organizationCode:this.eventItem.eventThree.organizationid,
				}
				getcaseHandingsendperson(parse).then((res)=>{
					uni.hideLoading();
					if(res.code == '200'){
						this.persenList = res.data;
					}else{
						this.$tip.toast(res.msg)
					}
				}).catch((error) => {
					this.$tip.toast(error.msg)
					uni.hideLoading();
				})
			},

			//获取案件详情
			getEventInfoByEventId(){
				getEventInfoByEventId({eventId: this.eventItem.eventId? this.eventItem.eventId: this.case_id}).then((res) => {
					if(res.code == 200){
						this.eventItem = res.data;
						this.longitude = this.eventItem.gdx;
						this.latitude = this.eventItem.gdy;
						this.covers.push({
							latitude: this.eventItem.gdy,
							longitude: this.eventItem.gdx,
							//iconPath: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png'
							iconPath: '../../static/city-manage/case.png'
						})
						//处置时限
						this.archivesDisposal = res.data.archivesDisposal;
						let isrepeat = true;
						this.archivesDisposal.forEach((ele,index) => {
							if(isrepeat){
								if(ele.times !== 0){
									isrepeat = false;
									this.times = ele.times;
									this.timesTypeName = ele.timesTypeName;
									this.timesUnitName = ele.timesUnitName;
								}
							}
						})

					}else{
						this.$tip.toast(res.msg)
					}
				}).catch((error) => {
				})
			},
			// 切换tab键
			changeTab(e) {
				this.btnnum = e
				if(this.btnnum == 1){}
			},
			// getisCheckSHcase,getisCheckBack
			//案件审核
			getCaseSh(remarks){
				uni.showLoading()
				let parmes = {
					eventId:this.eventItem.eventId?this.eventItem.eventId: this.case_id,  //案卷id
					remark:remarks,
				}
				getisCheckSHcase(parmes).then((res)=>{
					uni.hideLoading();
					if(res.code == '200'){
						this.$tip.toast(res.msg)
						// this.cancel(1);
						uni.$emit("handleFun",{title: 'shenhe'});
						setTimeout(()=> {
							uni.navigateBack({
								delta: 1 // 返回上一级页面。
							})
						},1000)
					}else{
						this.$tip.toast(res.msg)
					}
				}).catch((error) => {
					this.$tip.toast(error.msg)
					uni.hideLoading();
				})
			},
			getCaseBh(remarks){
				uni.showLoading()
				let parmes = {
					eventId:this.eventItem.eventId?this.eventItem.eventId: this.case_id,  //案卷id
					remark:remarks,
				}
				getisCheckBack(parmes).then((res)=>{
					uni.hideLoading();
					if(res.code == '200'){
						this.$tip.toast(res.msg)
						// this.cancel(1);
						uni.$emit("handleFun",{title: 'bohui'});
						setTimeout(()=> {
							uni.navigateBack({
								delta: 1 // 返回上一级页面。
							})
						},1000)
					}else{
						this.$tip.toast(res.msg)
					}
				}).catch((error) => {
					this.$tip.toast(error.msg)
					uni.hideLoading();
				})
			},
			//案件处理
			managementCase(current_handing_type){
				this.current_handing_type = current_handing_type;
				if(current_handing_type < 4){
					uni.removeStorageSync('currentLocation');
					uni.navigateTo({
						url: '/pages/pending-cases/managementCase?gdx='+this.eventItem.gdx+'&gdy='+this.eventItem.gdy+'&eventId='+ (this.eventItem.eventId? this.eventItem.eventId: this.case_id) + '&current_handing_type='+current_handing_type
					})
				}else if(current_handing_type == 5){
					this.ngOnInit(current_handing_type)
					//打开案件评价弹出层
					this.$refs.popupPingjia.open();
				}else if(current_handing_type == 4){
					this.ngOnInit(current_handing_type)
					//打开案件评价弹出层
					this.$refs.popupPingjia.open();
				}

			},
			ngOnInit(content_type) {

			    switch (content_type) {
			      case 4://督办
			        this.mtitle = '督办描述';
			        break;
			      case 5://评价
			        this.mtitle = '评价内容';
			        break;
			      case 6://案件回退
			        this.mtitle = '案件回退';
			        break;
			      case 7://案件审核
			        this.mtitle = '案件审核';
			        break;
			      case 8://延期申请
			        this.mtitle = '延期申请';
			        break;
			      case 9://缓办申请
			        this.mtitle = '缓办申请';
			        break;
			    }

			},
			confirmPingjia(){
				if(this.evaluateStatus == '' && this.current_handing_type == 5){
					this.$tip.toast('请选择案件评价')
					return
				}
				if(this.evaluateRemark == ''){
					this.$tip.toast('请输入评价内容')
					return
				}
				let option = {
					evaluateStatus: this.evaluateStatus,
					evaluateRemark: this.evaluateRemark,
					eventId: this.eventItem.eventId? this.eventItem.eventId: this.case_id
				}
				updateEventEvaluate(option).then((res) => {
					if (res.code == 200) {
						this.$tip.toast('提交成功', ()=>{
							this.$refs.popupPingjia.close();
							setTimeout(()=> {
								uni.navigateTo({
									url:"/pages/my-task/taskList"
								})
							},1000)
						})
					} else {
						this.$tip.toast(res.msg);
					}
				}).catch((error) => {
				})
			},
			//关闭案件评价弹出层
			closePopupPingjia(){
				this.$refs.popupPingjia.close();
			},
			//查看大地图
			lookBIgMap(){
				this.gdx = this.eventItem.gdx;
				this.gdy = this.eventItem.gdy;
				this.isShow = true;
				// this.$refs.popupMap.open();
				setTimeout(()=> {
					this.$nextTick(() => {
						// #ifdef H5
						this.$refs.publicMapDialog.initMap();
						// #endif
					});
				},500);
				// const subNVueyanqi = uni.getSubNVueById('newPublicMap')
				// this.$emit('locationMap',{
				// 	gdx:this.gdx,
				// 	gdy:this.gdy
				// })
				// subNVueyanqi.show('fade-in', 300, function() {})

			},
			//关闭弹出层
			closeToggleMap(){
				this.$refs.popupMap.close();
			},
			//初始化地图
			initMap(){
				this.GDMap = new AMap.Map('MyMap', {
					zoom: 12,
					viewMode: '2D',
					center: [108.99569,34.20124],
					resizeEnable: true,
				});
				//定位
				this.initPoint(this.eventItem.gdx, this.eventItem.gdy);
			},
			//定位
			initPoint(gdx, gdy){
				var icon = new AMap.Icon({
				    size: new AMap.Size(40, 50),    // 图标尺寸
				    image: '../../static/city-manage/case.png',
				    imageSize: new AMap.Size(25, 25)   // 根据所设置的大小拉伸或压缩图片
				});
				this.marker = new AMap.Marker({
					icon: icon,
					position: [gdx, gdy],
					offset: new AMap.Pixel(-13, -30)
				});
				this.marker.setMap(this.GDMap);
				this.GDMap.setCenter([gdx, gdy]);// 执行定位
			},
			//案件列表查看大图
			seeImages(index, bigImgData, type){
				let bigImgDataPath = [];

				if(type == 'details'){
					bigImgData.forEach((ele) => {
						bigImgDataPath.push(this.image_url + ele.path);
					})
				}else if(type == 'logs'){
					bigImgData.forEach((ele) => {
						bigImgDataPath.push(this.image_url + ele.path);
					})
				}

				let _this = this;
				uni.previewImage({
					urls: bigImgDataPath,
					current: index,
					longPressActions: {
						success: function(data) {
						},
						fail: function(err) {
						}
					}
				});
			},
			//案件处置日志
			getEventLogList(){
				uni.showLoading()
				getEventLogList({eventId: this.eventItem.eventId? this.eventItem.eventId: this.case_id}).then((res) => {
					if(res.code === 200){
						this.eventLogListData = res.data;
						for(var k=0;k<res.data.length;k++){
							var images = JSON.parse(res.data[k].images);
							var small_images = [];
							var big_images = [];
							for(var i=0;i<images.length;i++){
							   small_images.push(images[i]);
							   // big_images.push(images[i]);
							switch (images[i].size_type) {
								case '0':
									// small_images.push(images[i]);
									break;
								case '1':
									big_images.push(images[i]);
									break;
							 }
							}
						   this.eventLogListData[k].small_images = small_images;
						   this.eventLogListData[k].big_images = big_images;
						}
						this.smallImgData = small_images;
						this.bigImgData = big_images;
					}
					uni.hideLoading()
				}).catch((error) => {
					uni.hideLoading()
				})
			}
		}
	}
</script>

<style lang="scss">
	.event_details{
		padding-bottom: 92rpx;
		.event_box{
			background: #fff;
			height:100%;
			display: flex;
			flex-direction: column;
			position: relative;
			margin: 24rpx;
			margin-top:110rpx;
			//处置按钮
			.pending_buttons{
				display: flex;
				justify-content: space-between;
				position: fixed;
				bottom: 0rpx;
				right: 0rpx;
				left: 0rpx;
				margin: 24rpx;
				button{
					margin:0;
					flex:1;
					color:#fff;
					border-radius: 50rpx;
					// background: linear-gradient(to right, #ee625f, #ae0909);
					background: #FF6A60;
					&::after{
						border:none;
					}
				}
				.btnState{
					width: 100%;
					display: flex;
					flex: 1;
					text-decoration: row;
					justify-content: space-around;
				}
			}
		}
	}

	.end-title{
		position: fixed;
		top: 0rpx;
		right: 0rpx;
		left: 0rpx;
		z-index: 9;
        display: flex;
		//#ifdef H5
		margin-top: 44px;
		//#endif
		padding: 24rpx 24rpx 0px;
		background-color: #F5F5F5;
		view{
			flex-grow: 1;
			text-align: center;
			padding: 12rpx 0;
			border-bottom: 1px solid $qj-color;
			box-sizing: border-box;
			font-size: 30rpx;
		}
		.btna{
		    color: #FFFFFF;
		   background: $qj-color;
		}
    }
    .end-cont{
        display: none;
		overflow: auto;
		.type_status{
			display:flex;
			justify-content: space-between;
			padding: 20rpx 20rpx;
			align-items: center;
			background: #f5f5f5;
			font-weight: bold;
			.event_type{
				color:$qj-color;
				font-size: 30rpx;
			}
			.event_status{
				// color:#fff;
				color: #BA433B;
				font-size: 26rpx;
				// background: $qj-color;
				background:#F4E9E8;
				padding: 4rpx 25rpx;
				border-radius: 40rpx;
			}
		}
		.event_msg{
			padding:12rpx 20rpx;
			.msg_item{
				font-size: 30rpx;
			}
			.msg_item1{
				font-size: 30rpx;
				.msg_item1_img{
					width: 512rpx;
					height: 50rpx;
					float: right;
					.msg_item1_img1{
						width: 60rpx;
						height: 50rpx;
						float: left;
						margin-left: 10rpx;
					}
				}
			}

		}
		.map_image{
			padding: 0 20rpx;
			display: flex;
			justify-content: space-between;
			.map_box,.image_box{
				width: 316rpx;
				height:280rpx;
				border:1px solid #ccc;
			}
			.map_box{
				position: relative;
				#MyMap{
					width: 312rpx;
					height:276rpx;
				}
				.screen_big{

					z-index: 9999;
				}
				.H5_map{
					width:100%;
					height:100%;
					.coverImag{
						position: absolute;
						top:0;
						right:0;
						width: 36rpx;
						height: 36rpx;
						z-index: 999;
					}
				}
			}
			.image_box{
				image{
					width: 316rpx;
					height:100%;
				}
				image:first-child ~ image{
					display: none;
				}
			}
		}
		.event_logs{

			.logs_item{
				display: flex;
				flex-direction: row;
				margin: 30rpx 0;
				.circle{
					width: 24rpx;
					height:24rpx;
					border-radius: 50%;
					margin: 20rpx;
					background: $qj-gary;

				}
				&:first-child .circle{
					background: $qj-color;
				}
				.logs_box{
					width: 584rpx;
					padding: 20rpx;
					box-shadow: #b5cede 0px 0px 10px;
					background: white;
					border-radius: 10rpx;
					.logs_status{
						display: inline-block;
						color:#fff;
						font-size: 24rpx;
						padding: 2rpx 16rpx;
						border-radius: 10rpx;
						background: $qj-gary;
						padding: 4rpx 16rpx;
						border-radius: 10rpx;
					}
					.task_date{
						color: $qj-gary;
						font-size: 24rpx;
					}
					.logs_msg{
						color: $qj-black;
						font-size: 26rpx;
						text-align: justify;
					}
					.logs_image{
						width: 100%;
						height: 380rpx;
						text-align: center;
						margin: 10px 0;
						image{
							width: 352rpx;
							height:100%;
							border:1px solid #ccc;
						}
						image:first-child ~ image{
							display: none;
						}
					}
				}
				&:first-child .logs_box{
					.logs_status{
						background: $qj-color;
					}
				}
			}
		}
    }
	.end_cont_two{
		//background: #f5f5f5;
	}
    .dis{
        display: block;
    }

	//地图弹出层
	.uni-popup__wrapper-box{
		position: relative;
		z-index: 999999999;
		.popup-content {
			background-color: #fff;
			padding: 20rpx;
			position: relative;
			width:640rpx;
			// #ifdef APP-PLUS
				height:1000rpx;
			// #endif
			// #ifdef H5
				height:1000rpx;
			// #endif
			.close_map{
				width:30rpx;
				height:30rpx;
				position: absolute;
				right: -24rpx;
				top: -22rpx;
				background: #fff;
				border: 4rpx solid #ccc;
				border-radius: 50%;
				padding: 10rpx;
				z-index: 999999;
			}

		}
		.popup-content-pingjia{
			background-color: #fff;
			width:600rpx;
			border-radius: 10rpx;
			.pingjia_content{
				padding: 20rpx;
				.content_item{
					display: flex;
					margin-bottom:20rpx;
					.item_label{
						width:140rpx;
					}
					select{
						width:calc(100% - 146rpx);
						line-height: 34rpx;
					}
					textarea{
						width:calc(100% - 182rpx);
						border:1px solid #ccc;
						box-sizing: border-box;
						border-radius: 6rpx;
						font-size: 28rpx;
						padding:16rpx;
					}
				}
			}
			//处置按钮
			.pending_buttons{
				display: flex;
				justify-content: space-between;
				border-top::1px solid #f5f5f5;
				button{
					margin:0;
					flex:1;
					border-radius: 0;
					background: #fff;
					font-size: 28rpx;
					height:90rpx;
					line-height: 90rpx;
					&::after{
						border:none;
					}
					&:first-child{
						border-right:1px solid #f5f5f5;
						border-bottom-left-radius: 10rpx;
					}
					&:last-child{
						color:#007aff;
						border-bottom-right-radius: 10rpx;
					}
				}
			}
		}
	}

	/* 提示窗口 */
	    .uni-tip {
	        padding: 15px;
	        width: 300px;
	        background: #fff;
	        box-sizing: border-box;
	        border-radius: 10px;
	    }

	    .uni-tip-title {
	        text-align: center;
	        font-weight: bold;
	        font-size: 16px;
	        color: #333;
	        text-align: left;
	    }
		.uni-contant{
			height: 260rpx;
			overflow-y: scroll;
			text-align: center;
			.btna1{
				color: #007aff;
			}
		}
	    .uni-tip-content {
	        padding: 15px;
	        font-size: 14px;
	        color: #666;
	        /* background: #C8C7CC; */
	        border:2upx solid #ccc;
	        border-radius: 10upx;
	    }

	    .uni-tip-content-textarea{
	        height: 300upx;
	        width: 100%;
	        text-align: left;
	    }
	    .uni-tip-group-button {
	        margin-top: 10px;
	        display: flex;
	    }
	    .uni-tip-group-button{
	        display: flex;
	        justify-content: space-between;
	        border-top::1px solid #f5f5f5;
	        button{
	        	margin:0;
	        	flex:1;
	        	border-radius: 0;
	        	background: #fff;
	        	font-size: 28rpx;
	        	height:90rpx;
	        	line-height: 90rpx;
	        	&::after{
	        		border:none;
	        	}
	        	&:first-child{
	        		border-right:1px solid #f5f5f5;
	        		border-bottom-left-radius: 10rpx;
	        	}
	        	&:last-child{
	        		color:#007aff;
	        		border-bottom-right-radius: 10rpx;
	        	}
	        }
	    }

		.describe{
			padding: 20rpx;
			font-size: 32rpx;
			line-height: 44rpx;
		}
</style>
